
<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <meta charset="utf-8" />
    <title>E_vs_r_scan calculation style &#8212; iprPy 0.10.2 documentation</title>
    <link rel="stylesheet" href="../_static/basic.css" type="text/css" />
    <link rel="stylesheet" href="../_static/pygments.css" type="text/css" />
    <script type="text/javascript" id="documentation_options" data-url_root="../" src="../_static/documentation_options.js"></script>
    <script type="text/javascript" src="../_static/jquery.js"></script>
    <script type="text/javascript" src="../_static/underscore.js"></script>
    <script type="text/javascript" src="../_static/doctools.js"></script>
    <script type="text/javascript" src="../_static/language_data.js"></script>
    <script crossorigin="anonymous" integrity="sha256-Ae2Vz/4ePdIu6ZyI/5ZGsYnb+m0JlOmKPjt6XZ9JJkA=" type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/require.js/2.3.4/require.min.js"></script>
    <script async="async" type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/latest.js?config=TeX-AMS-MML_HTMLorMML"></script>
    <script type="text/x-mathjax-config">MathJax.Hub.Config({"tex2jax": {"inlineMath": [["$", "$"], ["\\(", "\\)"]], "processEscapes": true, "ignoreClass": "document", "processClass": "math|output_area"}})</script>
    <link rel="index" title="Index" href="../genindex.html" />
    <link rel="search" title="Search" href="../search.html" />
    <link rel="next" title="crystal_space_group calculation style" href="crystal_space_group.html" />
    <link rel="prev" title="Jupyter Demonstration Notebooks" href="../notebook_styles.html" /> 
  </head><body>
    <div class="related" role="navigation" aria-label="related navigation">
      <h3>Navigation</h3>
      <ul>
        <li class="right" style="margin-right: 10px">
          <a href="../genindex.html" title="General Index"
             accesskey="I">index</a></li>
        <li class="right" >
          <a href="../py-modindex.html" title="Python Module Index"
             >modules</a> |</li>
        <li class="right" >
          <a href="crystal_space_group.html" title="crystal_space_group calculation style"
             accesskey="N">next</a> |</li>
        <li class="right" >
          <a href="../notebook_styles.html" title="Jupyter Demonstration Notebooks"
             accesskey="P">previous</a> |</li>
        <li class="nav-item nav-item-0"><a href="../index.html">iprPy 0.10.2 documentation</a> &#187;</li>
          <li class="nav-item nav-item-1"><a href="../notebook_styles.html" accesskey="U">Jupyter Demonstration Notebooks</a> &#187;</li> 
      </ul>
    </div>  

    <div class="document">
      <div class="documentwrapper">
        <div class="bodywrapper">
          <div class="body" role="main">
            
  
<style>
/* CSS for nbsphinx extension */

/* remove conflicting styling from Sphinx themes */
div.nbinput.container,
div.nbinput.container div.prompt,
div.nbinput.container div.input_area,
div.nbinput.container div[class*=highlight],
div.nbinput.container div[class*=highlight] pre,
div.nboutput.container,
div.nboutput.container div.prompt,
div.nboutput.container div.output_area,
div.nboutput.container div[class*=highlight],
div.nboutput.container div[class*=highlight] pre {
    background: none;
    border: none;
    padding: 0 0;
    margin: 0;
    box-shadow: none;
}

/* avoid gaps between output lines */
div.nboutput.container div[class*=highlight] pre {
    line-height: normal;
}

/* input/output containers */
div.nbinput.container,
div.nboutput.container {
    display: -webkit-flex;
    display: flex;
    align-items: flex-start;
    margin: 0;
    width: 100%;
}
@media (max-width: 540px) {
    div.nbinput.container,
    div.nboutput.container {
        flex-direction: column;
    }
}

/* input container */
div.nbinput.container {
    padding-top: 5px;
}

/* last container */
div.nblast.container {
    padding-bottom: 5px;
}

/* input prompt */
div.nbinput.container div.prompt pre {
    color: #307FC1;
}

/* output prompt */
div.nboutput.container div.prompt pre {
    color: #BF5B3D;
}

/* all prompts */
div.nbinput.container div.prompt,
div.nboutput.container div.prompt {
    width: 4.5ex;
    padding-top: 5px;
    position: relative;
    user-select: none;
}

div.nbinput.container div.prompt > div,
div.nboutput.container div.prompt > div {
    position: absolute;
    right: 0;
    margin-right: 0.3ex;
}

@media (max-width: 540px) {
    div.nbinput.container div.prompt,
    div.nboutput.container div.prompt {
        width: unset;
        text-align: left;
        padding: 0.4em;
    }
    div.nboutput.container div.prompt.empty {
        padding: 0;
    }

    div.nbinput.container div.prompt > div,
    div.nboutput.container div.prompt > div {
        position: unset;
    }
}

/* disable scrollbars on prompts */
div.nbinput.container div.prompt pre,
div.nboutput.container div.prompt pre {
    overflow: hidden;
}

/* input/output area */
div.nbinput.container div.input_area,
div.nboutput.container div.output_area {
    -webkit-flex: 1;
    flex: 1;
    overflow: auto;
}
@media (max-width: 540px) {
    div.nbinput.container div.input_area,
    div.nboutput.container div.output_area {
        width: 100%;
    }
}

/* input area */
div.nbinput.container div.input_area {
    border: 1px solid #e0e0e0;
    border-radius: 2px;
    background: #f5f5f5;
}

/* override MathJax center alignment in output cells */
div.nboutput.container div[class*=MathJax] {
    text-align: left !important;
}

/* override sphinx.ext.imgmath center alignment in output cells */
div.nboutput.container div.math p {
    text-align: left;
}

/* standard error */
div.nboutput.container div.output_area.stderr {
    background: #fdd;
}

/* ANSI colors */
.ansi-black-fg { color: #3E424D; }
.ansi-black-bg { background-color: #3E424D; }
.ansi-black-intense-fg { color: #282C36; }
.ansi-black-intense-bg { background-color: #282C36; }
.ansi-red-fg { color: #E75C58; }
.ansi-red-bg { background-color: #E75C58; }
.ansi-red-intense-fg { color: #B22B31; }
.ansi-red-intense-bg { background-color: #B22B31; }
.ansi-green-fg { color: #00A250; }
.ansi-green-bg { background-color: #00A250; }
.ansi-green-intense-fg { color: #007427; }
.ansi-green-intense-bg { background-color: #007427; }
.ansi-yellow-fg { color: #DDB62B; }
.ansi-yellow-bg { background-color: #DDB62B; }
.ansi-yellow-intense-fg { color: #B27D12; }
.ansi-yellow-intense-bg { background-color: #B27D12; }
.ansi-blue-fg { color: #208FFB; }
.ansi-blue-bg { background-color: #208FFB; }
.ansi-blue-intense-fg { color: #0065CA; }
.ansi-blue-intense-bg { background-color: #0065CA; }
.ansi-magenta-fg { color: #D160C4; }
.ansi-magenta-bg { background-color: #D160C4; }
.ansi-magenta-intense-fg { color: #A03196; }
.ansi-magenta-intense-bg { background-color: #A03196; }
.ansi-cyan-fg { color: #60C6C8; }
.ansi-cyan-bg { background-color: #60C6C8; }
.ansi-cyan-intense-fg { color: #258F8F; }
.ansi-cyan-intense-bg { background-color: #258F8F; }
.ansi-white-fg { color: #C5C1B4; }
.ansi-white-bg { background-color: #C5C1B4; }
.ansi-white-intense-fg { color: #A1A6B2; }
.ansi-white-intense-bg { background-color: #A1A6B2; }

.ansi-default-inverse-fg { color: #FFFFFF; }
.ansi-default-inverse-bg { background-color: #000000; }

.ansi-bold { font-weight: bold; }
.ansi-underline { text-decoration: underline; }


div.nbinput.container div.input_area div[class*=highlight] > pre,
div.nboutput.container div.output_area div[class*=highlight] > pre,
div.nboutput.container div.output_area div[class*=highlight].math,
div.nboutput.container div.output_area.rendered_html,
div.nboutput.container div.output_area > div.output_javascript,
div.nboutput.container div.output_area:not(.rendered_html) > img{
    padding: 5px;
}

/* fix copybtn overflow problem in chromium (needed for 'sphinx_copybutton') */
div.nbinput.container div.input_area > div[class^='highlight'],
div.nboutput.container div.output_area > div[class^='highlight']{
    overflow-y: hidden;
}

/* hide copybtn icon on prompts (needed for 'sphinx_copybutton') */
.prompt a.copybtn {
    display: none;
}

/* Some additional styling taken form the Jupyter notebook CSS */
div.rendered_html table {
  border: none;
  border-collapse: collapse;
  border-spacing: 0;
  color: black;
  font-size: 12px;
  table-layout: fixed;
}
div.rendered_html thead {
  border-bottom: 1px solid black;
  vertical-align: bottom;
}
div.rendered_html tr,
div.rendered_html th,
div.rendered_html td {
  text-align: right;
  vertical-align: middle;
  padding: 0.5em 0.5em;
  line-height: normal;
  white-space: normal;
  max-width: none;
  border: none;
}
div.rendered_html th {
  font-weight: bold;
}
div.rendered_html tbody tr:nth-child(odd) {
  background: #f5f5f5;
}
div.rendered_html tbody tr:hover {
  background: rgba(66, 165, 245, 0.2);
}
</style>
<div class="section" id="E_vs_r_scan-calculation-style">
<h1>E_vs_r_scan calculation style<a class="headerlink" href="#E_vs_r_scan-calculation-style" title="Permalink to this headline">¶</a></h1>
<p><strong>Lucas M. Hale</strong>, <a class="reference external" href="mailto:lucas&#46;hale&#37;&#52;&#48;nist&#46;gov?Subject=ipr-demo">lucas<span>&#46;</span>hale<span>&#64;</span>nist<span>&#46;</span>gov</a>, <em>Materials Science and Engineering Division, NIST</em>.</p>
<div class="section" id="Introduction">
<h2>Introduction<a class="headerlink" href="#Introduction" title="Permalink to this headline">¶</a></h2>
<p>The E_vs_r_scan calculation style calculation creates a plot of the cohesive energy vs interatomic spacing, <span class="math notranslate nohighlight">\(r\)</span>, for a given atomic system. The system size is uniformly scaled (<span class="math notranslate nohighlight">\(b/a\)</span> and <span class="math notranslate nohighlight">\(c/a\)</span> ratios held fixed) and the energy is calculated at a number of sizes without relaxing the system. All box sizes corresponding to energy minima are identified.</p>
<p>This calculation was created as a quick method for scanning the phase space of a crystal structure with a given potential in order to identify starting guesses for further structure refinement calculations.</p>
<div class="section" id="Version-notes">
<h3>Version notes<a class="headerlink" href="#Version-notes" title="Permalink to this headline">¶</a></h3>
<ul class="simple">
<li><p>2018-07-09: Notebook added.</p></li>
<li><p>2019-07-30: Description updated and small changes due to iprPy version.</p></li>
<li><p>2020-05-22: Version 0.10 update - potentials now loaded from database.</p></li>
<li><p>2020-09-22: Setup and parameter definitions streamlined.</p></li>
</ul>
</div>
<div class="section" id="Additional-dependencies">
<h3>Additional dependencies<a class="headerlink" href="#Additional-dependencies" title="Permalink to this headline">¶</a></h3>
</div>
<div class="section" id="Disclaimers">
<h3>Disclaimers<a class="headerlink" href="#Disclaimers" title="Permalink to this headline">¶</a></h3>
<ul class="simple">
<li><p><a class="reference external" href="http://www.nist.gov/public_affairs/disclaimer.cfm">NIST disclaimers</a></p></li>
<li><p>The minima identified by this calculation do not guarantee that the associated crystal structure will be stable as no relaxation is performed by this calculation. Upon relaxation, the atomic positions and box dimensions may transform the system to a different structure.</p></li>
<li><p>It is possible that the calculation may miss an existing minima for a crystal structure if it is outside the range of <span class="math notranslate nohighlight">\(r\)</span> values scanned, or has <span class="math notranslate nohighlight">\(b/a\)</span>, <span class="math notranslate nohighlight">\(c/a\)</span> values far from the ideal.</p></li>
</ul>
</div>
</div>
<div class="section" id="Method-and-Theory">
<h2>Method and Theory<a class="headerlink" href="#Method-and-Theory" title="Permalink to this headline">¶</a></h2>
<p>An initial system (and corresponding unit cell system) is supplied. The <span class="math notranslate nohighlight">\(r/a\)</span> ratio is identified from the unit cell. The system is then uniformly scaled to all <span class="math notranslate nohighlight">\(r_i\)</span> values in the range to be explored and the energy for each is evaluated using LAMMPS and “run 0” command, i.e. no relaxations are performed.</p>
<p>In identifying energy minima along the curve, only the explored values are used without interpolation. In this way, the possible energy minima structures are identified for <span class="math notranslate nohighlight">\(r_i\)</span> where <span class="math notranslate nohighlight">\(E(r_i) &lt; E(r_{i-1})\)</span> and <span class="math notranslate nohighlight">\(E(r_i) &lt; E(r_{i+1})\)</span>.</p>
</div>
<div class="section" id="Demonstration">
<h2>Demonstration<a class="headerlink" href="#Demonstration" title="Permalink to this headline">¶</a></h2>
<div class="section" id="1.-Setup">
<h3>1. Setup<a class="headerlink" href="#1.-Setup" title="Permalink to this headline">¶</a></h3>
<div class="section" id="1.1.-Library-imports">
<h4>1.1. Library imports<a class="headerlink" href="#1.1.-Library-imports" title="Permalink to this headline">¶</a></h4>
<p>Import libraries needed by the calculation. The external libraries used are:</p>
<ul class="simple">
<li><p><a class="reference external" href="http://www.numpy.org/">numpy</a></p></li>
<li><p><a class="reference external" href="https://github.com/usnistgov/atomman">atomman</a></p></li>
<li><p><a class="reference external" href="https://github.com/usnistgov/iprPy">iprPy</a></p></li>
</ul>
<div class="nbinput docutils container">
<div class="prompt highlight-none notranslate"><div class="highlight"><pre><span></span>[1]:
</pre></div>
</div>
<div class="input_area highlight-ipython3 notranslate"><div class="highlight"><pre>
<span></span><span class="c1"># Standard library imports</span>
<span class="kn">from</span> <span class="nn">pathlib</span> <span class="k">import</span> <span class="n">Path</span>
<span class="kn">import</span> <span class="nn">os</span>
<span class="kn">import</span> <span class="nn">datetime</span>
<span class="kn">from</span> <span class="nn">copy</span> <span class="k">import</span> <span class="n">deepcopy</span>
<span class="kn">from</span> <span class="nn">math</span> <span class="k">import</span> <span class="n">floor</span>

<span class="c1"># http://www.numpy.org/</span>
<span class="kn">import</span> <span class="nn">numpy</span> <span class="k">as</span> <span class="nn">np</span>

<span class="c1"># https://github.com/usnistgov/atomman</span>
<span class="kn">import</span> <span class="nn">atomman</span> <span class="k">as</span> <span class="nn">am</span>
<span class="kn">import</span> <span class="nn">atomman.lammps</span> <span class="k">as</span> <span class="nn">lmp</span>
<span class="kn">import</span> <span class="nn">atomman.unitconvert</span> <span class="k">as</span> <span class="nn">uc</span>

<span class="c1"># https://github.com/usnistgov/iprPy</span>
<span class="kn">import</span> <span class="nn">iprPy</span>

<span class="nb">print</span><span class="p">(</span><span class="s1">&#39;Notebook last executed on&#39;</span><span class="p">,</span> <span class="n">datetime</span><span class="o">.</span><span class="n">date</span><span class="o">.</span><span class="n">today</span><span class="p">(),</span> <span class="s1">&#39;using iprPy version&#39;</span><span class="p">,</span> <span class="n">iprPy</span><span class="o">.</span><span class="n">__version__</span><span class="p">)</span>
</pre></div>
</div>
</div>
<div class="nboutput nblast docutils container">
<div class="prompt empty docutils container">
</div>
<div class="output_area docutils container">
<div class="highlight"><pre>
Notebook last executed on 2020-09-22 using iprPy version 0.10.2
</pre></div></div>
</div>
<p>Import additional libraries for plotting. The external libraries used are:</p>
<ul class="simple">
<li><p><a class="reference external" href="http://bokeh.pydata.org/">bokeh</a></p></li>
</ul>
<div class="nbinput docutils container">
<div class="prompt highlight-none notranslate"><div class="highlight"><pre><span></span>[2]:
</pre></div>
</div>
<div class="input_area highlight-ipython3 notranslate"><div class="highlight"><pre>
<span></span><span class="kn">import</span> <span class="nn">bokeh</span>
<span class="nb">print</span><span class="p">(</span><span class="s1">&#39;Bokeh version =&#39;</span><span class="p">,</span> <span class="n">bokeh</span><span class="o">.</span><span class="n">__version__</span><span class="p">)</span>
<span class="kn">from</span> <span class="nn">bokeh.plotting</span> <span class="k">import</span> <span class="n">figure</span><span class="p">,</span> <span class="n">output_file</span><span class="p">,</span> <span class="n">show</span>
<span class="kn">from</span> <span class="nn">bokeh.embed</span> <span class="k">import</span> <span class="n">components</span>
<span class="kn">from</span> <span class="nn">bokeh.resources</span> <span class="k">import</span> <span class="n">Resources</span>
<span class="kn">from</span> <span class="nn">bokeh.io</span> <span class="k">import</span> <span class="n">output_notebook</span>
<span class="n">output_notebook</span><span class="p">()</span>
</pre></div>
</div>
</div>
<div class="nboutput docutils container">
<div class="prompt empty docutils container">
</div>
<div class="output_area docutils container">
<div class="highlight"><pre>
Bokeh version = 1.3.4
</pre></div></div>
</div>
<div class="nboutput docutils container">
<div class="prompt empty docutils container">
</div>
<div class="output_area rendered_html docutils container">
<div class="bk-root">
    <a href="https://bokeh.pydata.org" target="_blank" class="bk-logo bk-logo-small bk-logo-notebook"></a>
    <span id="1001">Loading BokehJS ...</span>
</div></div>
</div>
<div class="nboutput nblast docutils container">
<div class="prompt empty docutils container">
</div>
<div class="output_area docutils container">
<div class="output_javascript"></div>
<script type="text/javascript">
var element = document.currentScript.previousSibling.previousSibling;

(function(root) {
  function now() {
    return new Date();
  }

  var force = true;

  if (typeof root._bokeh_onload_callbacks === "undefined" || force === true) {
    root._bokeh_onload_callbacks = [];
    root._bokeh_is_loading = undefined;
  }

  var JS_MIME_TYPE = 'application/javascript';
  var HTML_MIME_TYPE = 'text/html';
  var EXEC_MIME_TYPE = 'application/vnd.bokehjs_exec.v0+json';
  var CLASS_NAME = 'output_bokeh rendered_html';

  /**
   * Render data to the DOM node
   */
  function render(props, node) {
    var script = document.createElement("script");
    node.appendChild(script);
  }

  /**
   * Handle when an output is cleared or removed
   */
  function handleClearOutput(event, handle) {
    var cell = handle.cell;

    var id = cell.output_area._bokeh_element_id;
    var server_id = cell.output_area._bokeh_server_id;
    // Clean up Bokeh references
    if (id != null && id in Bokeh.index) {
      Bokeh.index[id].model.document.clear();
      delete Bokeh.index[id];
    }

    if (server_id !== undefined) {
      // Clean up Bokeh references
      var cmd = "from bokeh.io.state import curstate; print(curstate().uuid_to_server['" + server_id + "'].get_sessions()[0].document.roots[0]._id)";
      cell.notebook.kernel.execute(cmd, {
        iopub: {
          output: function(msg) {
            var id = msg.content.text.trim();
            if (id in Bokeh.index) {
              Bokeh.index[id].model.document.clear();
              delete Bokeh.index[id];
            }
          }
        }
      });
      // Destroy server and session
      var cmd = "import bokeh.io.notebook as ion; ion.destroy_server('" + server_id + "')";
      cell.notebook.kernel.execute(cmd);
    }
  }

  /**
   * Handle when a new output is added
   */
  function handleAddOutput(event, handle) {
    var output_area = handle.output_area;
    var output = handle.output;

    // limit handleAddOutput to display_data with EXEC_MIME_TYPE content only
    if ((output.output_type != "display_data") || (!output.data.hasOwnProperty(EXEC_MIME_TYPE))) {
      return
    }

    var toinsert = output_area.element.find("." + CLASS_NAME.split(' ')[0]);

    if (output.metadata[EXEC_MIME_TYPE]["id"] !== undefined) {
      toinsert[toinsert.length - 1].firstChild.textContent = output.data[JS_MIME_TYPE];
      // store reference to embed id on output_area
      output_area._bokeh_element_id = output.metadata[EXEC_MIME_TYPE]["id"];
    }
    if (output.metadata[EXEC_MIME_TYPE]["server_id"] !== undefined) {
      var bk_div = document.createElement("div");
      bk_div.innerHTML = output.data[HTML_MIME_TYPE];
      var script_attrs = bk_div.children[0].attributes;
      for (var i = 0; i < script_attrs.length; i++) {
        toinsert[toinsert.length - 1].firstChild.setAttribute(script_attrs[i].name, script_attrs[i].value);
      }
      // store reference to server id on output_area
      output_area._bokeh_server_id = output.metadata[EXEC_MIME_TYPE]["server_id"];
    }
  }

  function register_renderer(events, OutputArea) {

    function append_mime(data, metadata, element) {
      // create a DOM node to render to
      var toinsert = this.create_output_subarea(
        metadata,
        CLASS_NAME,
        EXEC_MIME_TYPE
      );
      this.keyboard_manager.register_events(toinsert);
      // Render to node
      var props = {data: data, metadata: metadata[EXEC_MIME_TYPE]};
      render(props, toinsert[toinsert.length - 1]);
      element.append(toinsert);
      return toinsert
    }

    /* Handle when an output is cleared or removed */
    events.on('clear_output.CodeCell', handleClearOutput);
    events.on('delete.Cell', handleClearOutput);

    /* Handle when a new output is added */
    events.on('output_added.OutputArea', handleAddOutput);

    /**
     * Register the mime type and append_mime function with output_area
     */
    OutputArea.prototype.register_mime_type(EXEC_MIME_TYPE, append_mime, {
      /* Is output safe? */
      safe: true,
      /* Index of renderer in `output_area.display_order` */
      index: 0
    });
  }

  // register the mime type if in Jupyter Notebook environment and previously unregistered
  if (root.Jupyter !== undefined) {
    var events = require('base/js/events');
    var OutputArea = require('notebook/js/outputarea').OutputArea;

    if (OutputArea.prototype.mime_types().indexOf(EXEC_MIME_TYPE) == -1) {
      register_renderer(events, OutputArea);
    }
  }


  if (typeof (root._bokeh_timeout) === "undefined" || force === true) {
    root._bokeh_timeout = Date.now() + 5000;
    root._bokeh_failed_load = false;
  }

  var NB_LOAD_WARNING = {'data': {'text/html':
     "<div style='background-color: #fdd'>\n"+
     "<p>\n"+
     "BokehJS does not appear to have successfully loaded. If loading BokehJS from CDN, this \n"+
     "may be due to a slow or bad network connection. Possible fixes:\n"+
     "</p>\n"+
     "<ul>\n"+
     "<li>re-rerun `output_notebook()` to attempt to load from CDN again, or</li>\n"+
     "<li>use INLINE resources instead, as so:</li>\n"+
     "</ul>\n"+
     "<code>\n"+
     "from bokeh.resources import INLINE\n"+
     "output_notebook(resources=INLINE)\n"+
     "</code>\n"+
     "</div>"}};

  function display_loaded() {
    var el = document.getElementById("1001");
    if (el != null) {
      el.textContent = "BokehJS is loading...";
    }
    if (root.Bokeh !== undefined) {
      if (el != null) {
        el.textContent = "BokehJS " + root.Bokeh.version + " successfully loaded.";
      }
    } else if (Date.now() < root._bokeh_timeout) {
      setTimeout(display_loaded, 100)
    }
  }


  function run_callbacks() {
    try {
      root._bokeh_onload_callbacks.forEach(function(callback) {
        if (callback != null)
          callback();
      });
    } finally {
      delete root._bokeh_onload_callbacks
    }
    console.debug("Bokeh: all callbacks have finished");
  }

  function load_libs(css_urls, js_urls, callback) {
    if (css_urls == null) css_urls = [];
    if (js_urls == null) js_urls = [];

    root._bokeh_onload_callbacks.push(callback);
    if (root._bokeh_is_loading > 0) {
      console.debug("Bokeh: BokehJS is being loaded, scheduling callback at", now());
      return null;
    }
    if (js_urls == null || js_urls.length === 0) {
      run_callbacks();
      return null;
    }
    console.debug("Bokeh: BokehJS not loaded, scheduling load and callback at", now());
    root._bokeh_is_loading = css_urls.length + js_urls.length;

    function on_load() {
      root._bokeh_is_loading--;
      if (root._bokeh_is_loading === 0) {
        console.debug("Bokeh: all BokehJS libraries/stylesheets loaded");
        run_callbacks()
      }
    }

    function on_error() {
      console.error("failed to load " + url);
    }

    for (var i = 0; i < css_urls.length; i++) {
      var url = css_urls[i];
      const element = document.createElement("link");
      element.onload = on_load;
      element.onerror = on_error;
      element.rel = "stylesheet";
      element.type = "text/css";
      element.href = url;
      console.debug("Bokeh: injecting link tag for BokehJS stylesheet: ", url);
      document.body.appendChild(element);
    }

    for (var i = 0; i < js_urls.length; i++) {
      var url = js_urls[i];
      var element = document.createElement('script');
      element.onload = on_load;
      element.onerror = on_error;
      element.async = false;
      element.src = url;
      console.debug("Bokeh: injecting script tag for BokehJS library: ", url);
      document.head.appendChild(element);
    }
  };var element = document.getElementById("1001");
  if (element == null) {
    console.error("Bokeh: ERROR: autoload.js configured with elementid '1001' but no matching script tag was found. ")
    return false;
  }

  function inject_raw_css(css) {
    const element = document.createElement("style");
    element.appendChild(document.createTextNode(css));
    document.body.appendChild(element);
  }

  var js_urls = ["https://cdn.pydata.org/bokeh/release/bokeh-1.3.4.min.js", "https://cdn.pydata.org/bokeh/release/bokeh-widgets-1.3.4.min.js", "https://cdn.pydata.org/bokeh/release/bokeh-tables-1.3.4.min.js", "https://cdn.pydata.org/bokeh/release/bokeh-gl-1.3.4.min.js"];
  var css_urls = [];

  var inline_js = [
    function(Bokeh) {
      Bokeh.set_log_level("info");
    },

    function(Bokeh) {

    },
    function(Bokeh) {} // ensure no trailing comma for IE
  ];

  function run_inline_js() {

    if ((root.Bokeh !== undefined) || (force === true)) {
      for (var i = 0; i < inline_js.length; i++) {
        inline_js[i].call(root, root.Bokeh);
      }if (force === true) {
        display_loaded();
      }} else if (Date.now() < root._bokeh_timeout) {
      setTimeout(run_inline_js, 100);
    } else if (!root._bokeh_failed_load) {
      console.log("Bokeh: BokehJS failed to load within specified timeout.");
      root._bokeh_failed_load = true;
    } else if (force !== true) {
      var cell = $(document.getElementById("1001")).parents('.cell').data().cell;
      cell.output_area.append_execute_result(NB_LOAD_WARNING)
    }

  }

  if (root._bokeh_is_loading === 0) {
    console.debug("Bokeh: BokehJS loaded, going straight to plotting");
    run_inline_js();
  } else {
    load_libs(css_urls, js_urls, function() {
      console.debug("Bokeh: BokehJS plotting callback run at", now());
      run_inline_js();
    });
  }
}(window));
</script></div>
</div>
</div>
<div class="section" id="1.2.-Default-calculation-setup">
<h4>1.2. Default calculation setup<a class="headerlink" href="#1.2.-Default-calculation-setup" title="Permalink to this headline">¶</a></h4>
<div class="nbinput nblast docutils container">
<div class="prompt highlight-none notranslate"><div class="highlight"><pre><span></span>[3]:
</pre></div>
</div>
<div class="input_area highlight-ipython3 notranslate"><div class="highlight"><pre>
<span></span><span class="c1"># Specify calculation style</span>
<span class="n">calc_style</span> <span class="o">=</span> <span class="s1">&#39;E_vs_r_scan&#39;</span>

<span class="c1"># If workingdir is already set, then do nothing (already in correct folder)</span>
<span class="k">try</span><span class="p">:</span>
    <span class="n">workingdir</span> <span class="o">=</span> <span class="n">workingdir</span>

<span class="c1"># Change to workingdir if not already there</span>
<span class="k">except</span><span class="p">:</span>
    <span class="n">workingdir</span> <span class="o">=</span> <span class="n">Path</span><span class="p">(</span><span class="s1">&#39;calculationfiles&#39;</span><span class="p">,</span> <span class="n">calc_style</span><span class="p">)</span>
    <span class="k">if</span> <span class="ow">not</span> <span class="n">workingdir</span><span class="o">.</span><span class="n">is_dir</span><span class="p">():</span>
        <span class="n">workingdir</span><span class="o">.</span><span class="n">mkdir</span><span class="p">(</span><span class="n">parents</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span>
    <span class="n">os</span><span class="o">.</span><span class="n">chdir</span><span class="p">(</span><span class="n">workingdir</span><span class="p">)</span>

<span class="c1"># Initialize connection to library</span>
<span class="n">library</span> <span class="o">=</span> <span class="n">iprPy</span><span class="o">.</span><span class="n">Library</span><span class="p">(</span><span class="n">load</span><span class="o">=</span><span class="p">[</span><span class="s1">&#39;lammps_potentials&#39;</span><span class="p">])</span>
</pre></div>
</div>
</div>
</div>
</div>
<div class="section" id="2.-Assign-values-for-the-calculation’s-run-parameters">
<h3>2. Assign values for the calculation’s run parameters<a class="headerlink" href="#2.-Assign-values-for-the-calculation’s-run-parameters" title="Permalink to this headline">¶</a></h3>
<div class="section" id="2.1.-Specify-system-specific-paths">
<h4>2.1. Specify system-specific paths<a class="headerlink" href="#2.1.-Specify-system-specific-paths" title="Permalink to this headline">¶</a></h4>
<ul class="simple">
<li><p><strong>lammps_command</strong> is the LAMMPS command to use (required).</p></li>
<li><p><strong>mpi_command</strong> MPI command for running LAMMPS in parallel. A value of None will run simulations serially.</p></li>
</ul>
<div class="nbinput nblast docutils container">
<div class="prompt highlight-none notranslate"><div class="highlight"><pre><span></span>[4]:
</pre></div>
</div>
<div class="input_area highlight-ipython3 notranslate"><div class="highlight"><pre>
<span></span><span class="n">lammps_command</span> <span class="o">=</span> <span class="s1">&#39;lmp_serial&#39;</span>
<span class="n">mpi_command</span> <span class="o">=</span> <span class="kc">None</span>
</pre></div>
</div>
</div>
</div>
<div class="section" id="2.2.-Load-interatomic-potential">
<h4>2.2. Load interatomic potential<a class="headerlink" href="#2.2.-Load-interatomic-potential" title="Permalink to this headline">¶</a></h4>
<ul class="simple">
<li><p><strong>potential_name</strong> gives the name of the potential_LAMMPS reference record in the iprPy library to use for the calculation.</p></li>
<li><p><strong>potential</strong> is an atomman.lammps.Potential object (required).</p></li>
</ul>
<div class="nbinput nblast docutils container">
<div class="prompt highlight-none notranslate"><div class="highlight"><pre><span></span>[5]:
</pre></div>
</div>
<div class="input_area highlight-ipython3 notranslate"><div class="highlight"><pre>
<span></span><span class="n">potential_name</span> <span class="o">=</span> <span class="s1">&#39;1999--Mishin-Y--Ni--LAMMPS--ipr1&#39;</span>

<span class="c1"># Retrieve potential and parameter file(s)</span>
<span class="n">potential</span> <span class="o">=</span> <span class="n">library</span><span class="o">.</span><span class="n">get_lammps_potential</span><span class="p">(</span><span class="nb">id</span><span class="o">=</span><span class="n">potential_name</span><span class="p">,</span> <span class="n">getfiles</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span>
</pre></div>
</div>
</div>
</div>
<div class="section" id="2.3.-Load-initial-unit-cell-system">
<h4>2.3. Load initial unit cell system<a class="headerlink" href="#2.3.-Load-initial-unit-cell-system" title="Permalink to this headline">¶</a></h4>
<ul class="simple">
<li><p><strong>ucell</strong> is an atomman.System representing a fundamental unit cell of the system (required). Here, this is generated using the load parameters and symbols.</p></li>
</ul>
<div class="nbinput docutils container">
<div class="prompt highlight-none notranslate"><div class="highlight"><pre><span></span>[6]:
</pre></div>
</div>
<div class="input_area highlight-ipython3 notranslate"><div class="highlight"><pre>
<span></span><span class="c1"># Create ucell by loading prototype record</span>
<span class="n">ucell</span> <span class="o">=</span> <span class="n">am</span><span class="o">.</span><span class="n">load</span><span class="p">(</span><span class="s1">&#39;prototype&#39;</span><span class="p">,</span> <span class="s1">&#39;A1--Cu--fcc&#39;</span><span class="p">,</span> <span class="n">symbols</span><span class="o">=</span><span class="s1">&#39;Ni&#39;</span><span class="p">,</span> <span class="n">a</span><span class="o">=</span><span class="mf">3.52</span><span class="p">)</span>

<span class="nb">print</span><span class="p">(</span><span class="n">ucell</span><span class="p">)</span>
</pre></div>
</div>
</div>
<div class="nboutput nblast docutils container">
<div class="prompt empty docutils container">
</div>
<div class="output_area docutils container">
<div class="highlight"><pre>
avect =  [ 3.520,  0.000,  0.000]
bvect =  [ 0.000,  3.520,  0.000]
cvect =  [ 0.000,  0.000,  3.520]
origin = [ 0.000,  0.000,  0.000]
natoms = 4
natypes = 1
symbols = (&#39;Ni&#39;,)
pbc = [ True  True  True]
per-atom properties = [&#39;atype&#39;, &#39;pos&#39;]
     id |   atype |  pos[0] |  pos[1] |  pos[2]
      0 |       1 |   0.000 |   0.000 |   0.000
      1 |       1 |   0.000 |   1.760 |   1.760
      2 |       1 |   1.760 |   0.000 |   1.760
      3 |       1 |   1.760 |   1.760 |   0.000
</pre></div></div>
</div>
</div>
<div class="section" id="2.4.-Modify-system">
<h4>2.4. Modify system<a class="headerlink" href="#2.4.-Modify-system" title="Permalink to this headline">¶</a></h4>
<ul class="simple">
<li><p><strong>sizemults</strong> list of three integers specifying how many times the ucell vectors of <span class="math notranslate nohighlight">\(a\)</span>, <span class="math notranslate nohighlight">\(b\)</span> and <span class="math notranslate nohighlight">\(c\)</span> are replicated in creating system.</p></li>
<li><p><strong>system</strong> is an atomman.System to perform the scan on (required).</p></li>
</ul>
<div class="nbinput docutils container">
<div class="prompt highlight-none notranslate"><div class="highlight"><pre><span></span>[7]:
</pre></div>
</div>
<div class="input_area highlight-ipython3 notranslate"><div class="highlight"><pre>
<span></span><span class="n">sizemults</span> <span class="o">=</span> <span class="p">[</span><span class="mi">3</span><span class="p">,</span> <span class="mi">3</span><span class="p">,</span> <span class="mi">3</span><span class="p">]</span>

<span class="c1"># Generate system by supersizing ucell</span>
<span class="n">system</span> <span class="o">=</span> <span class="n">ucell</span><span class="o">.</span><span class="n">supersize</span><span class="p">(</span><span class="o">*</span><span class="n">sizemults</span><span class="p">)</span>
<span class="nb">print</span><span class="p">(</span><span class="s1">&#39;# of atoms in system =&#39;</span><span class="p">,</span> <span class="n">system</span><span class="o">.</span><span class="n">natoms</span><span class="p">)</span>
</pre></div>
</div>
</div>
<div class="nboutput nblast docutils container">
<div class="prompt empty docutils container">
</div>
<div class="output_area docutils container">
<div class="highlight"><pre>
# of atoms in system = 108
</pre></div></div>
</div>
</div>
<div class="section" id="2.5.-Specify-calculation-specific-run-parameters">
<h4>2.5. Specify calculation-specific run parameters<a class="headerlink" href="#2.5.-Specify-calculation-specific-run-parameters" title="Permalink to this headline">¶</a></h4>
<ul class="simple">
<li><p><strong>rmin</strong> is the minimum r spacing to use.</p></li>
<li><p><strong>rmax</strong> is the minimum r spacing to use.</p></li>
<li><p><strong>rsteps</strong> is the number of r spacing steps to evaluate.</p></li>
</ul>
<div class="nbinput nblast docutils container">
<div class="prompt highlight-none notranslate"><div class="highlight"><pre><span></span>[8]:
</pre></div>
</div>
<div class="input_area highlight-ipython3 notranslate"><div class="highlight"><pre>
<span></span><span class="n">rmin</span> <span class="o">=</span> <span class="n">uc</span><span class="o">.</span><span class="n">set_in_units</span><span class="p">(</span><span class="mf">2.0</span><span class="p">,</span> <span class="s1">&#39;angstrom&#39;</span><span class="p">)</span>
<span class="n">rmax</span> <span class="o">=</span> <span class="n">uc</span><span class="o">.</span><span class="n">set_in_units</span><span class="p">(</span><span class="mf">6.0</span><span class="p">,</span> <span class="s1">&#39;angstrom&#39;</span><span class="p">)</span>
<span class="n">rsteps</span> <span class="o">=</span> <span class="mi">200</span>
</pre></div>
</div>
</div>
</div>
</div>
<div class="section" id="3.-Define-calculation-function(s)-and-generate-template-LAMMPS-script(s)">
<h3>3. Define calculation function(s) and generate template LAMMPS script(s)<a class="headerlink" href="#3.-Define-calculation-function(s)-and-generate-template-LAMMPS-script(s)" title="Permalink to this headline">¶</a></h3>
<div class="section" id="3.1.-run0.template">
<h4>3.1. run0.template<a class="headerlink" href="#3.1.-run0.template" title="Permalink to this headline">¶</a></h4>
<div class="nbinput nblast docutils container">
<div class="prompt highlight-none notranslate"><div class="highlight"><pre><span></span>[9]:
</pre></div>
</div>
<div class="input_area highlight-ipython3 notranslate"><div class="highlight"><pre>
<span></span><span class="k">with</span> <span class="nb">open</span><span class="p">(</span><span class="s1">&#39;run0.template&#39;</span><span class="p">,</span> <span class="s1">&#39;w&#39;</span><span class="p">)</span> <span class="k">as</span> <span class="n">f</span><span class="p">:</span>
    <span class="n">f</span><span class="o">.</span><span class="n">write</span><span class="p">(</span><span class="s2">&quot;&quot;&quot;#LAMMPS input script that evaluates a system&#39;s energy and pressure without relaxing</span>

<span class="s2">box tilt large</span>

<span class="s2">&lt;atomman_system_pair_info&gt;</span>

<span class="s2">variable peatom equal pe/atoms</span>

<span class="s2">thermo_style custom step lx ly lz pxx pyy pzz pe v_peatom</span>
<span class="s2">thermo_modify format float </span><span class="si">%.13e</span><span class="s2"></span>

<span class="s2">run 0&quot;&quot;&quot;</span><span class="p">)</span>
</pre></div>
</div>
</div>
</div>
<div class="section" id="3.2.-e_vs_r()">
<h4>3.2. e_vs_r()<a class="headerlink" href="#3.2.-e_vs_r()" title="Permalink to this headline">¶</a></h4>
<div class="nbinput nblast docutils container">
<div class="prompt highlight-none notranslate"><div class="highlight"><pre><span></span>[10]:
</pre></div>
</div>
<div class="input_area highlight-ipython3 notranslate"><div class="highlight"><pre>
<span></span><span class="k">def</span> <span class="nf">e_vs_r</span><span class="p">(</span><span class="n">lammps_command</span><span class="p">,</span> <span class="n">system</span><span class="p">,</span> <span class="n">potential</span><span class="p">,</span>
           <span class="n">mpi_command</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">ucell</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span>
           <span class="n">rmin</span><span class="o">=</span><span class="n">uc</span><span class="o">.</span><span class="n">set_in_units</span><span class="p">(</span><span class="mf">2.0</span><span class="p">,</span> <span class="s1">&#39;angstrom&#39;</span><span class="p">),</span>
           <span class="n">rmax</span><span class="o">=</span><span class="n">uc</span><span class="o">.</span><span class="n">set_in_units</span><span class="p">(</span><span class="mf">6.0</span><span class="p">,</span> <span class="s1">&#39;angstrom&#39;</span><span class="p">),</span> <span class="n">rsteps</span><span class="o">=</span><span class="mi">200</span><span class="p">):</span>
    <span class="sd">&quot;&quot;&quot;</span>
<span class="sd">    Performs a cohesive energy scan over a range of interatomic spaces, r.</span>

<span class="sd">    Parameters</span>
<span class="sd">    ----------</span>
<span class="sd">    lammps_command :str</span>
<span class="sd">        Command for running LAMMPS.</span>
<span class="sd">    system : atomman.System</span>
<span class="sd">        The system to perform the calculation on.</span>
<span class="sd">    potential : atomman.lammps.Potential</span>
<span class="sd">        The LAMMPS implemented potential to use.</span>
<span class="sd">    mpi_command : str, optional</span>
<span class="sd">        The MPI command for running LAMMPS in parallel.  If not given, LAMMPS</span>
<span class="sd">        will run serially.</span>
<span class="sd">    ucell : atomman.System, optional</span>
<span class="sd">        The fundamental unit cell correspodning to system.  This is used to</span>
<span class="sd">        convert system dimensions to cell dimensions. If not given, ucell will</span>
<span class="sd">        be taken as system.</span>
<span class="sd">    rmin : float, optional</span>
<span class="sd">        The minimum r spacing to use (default value is 2.0 angstroms).</span>
<span class="sd">    rmax : float, optional</span>
<span class="sd">        The maximum r spacing to use (default value is 6.0 angstroms).</span>
<span class="sd">    rsteps : int, optional</span>
<span class="sd">        The number of r spacing steps to evaluate (default value is 200).</span>

<span class="sd">    Returns</span>
<span class="sd">    -------</span>
<span class="sd">    dict</span>
<span class="sd">        Dictionary of results consisting of keys:</span>

<span class="sd">        - **&#39;r_values&#39;** (*numpy.array of float*) - All interatomic spacings,</span>
<span class="sd">          r, explored.</span>
<span class="sd">        - **&#39;a_values&#39;** (*numpy.array of float*) - All unit cell a lattice</span>
<span class="sd">          constants corresponding to the values explored.</span>
<span class="sd">        - **&#39;Ecoh_values&#39;** (*numpy.array of float*) - The computed cohesive</span>
<span class="sd">          energies for each r value.</span>
<span class="sd">        - **&#39;min_cell&#39;** (*list of atomman.System*) - Systems corresponding to</span>
<span class="sd">          the minima identified in the Ecoh_values.</span>
<span class="sd">    &quot;&quot;&quot;</span>
    <span class="c1"># Build filedict if function was called from iprPy</span>
    <span class="k">try</span><span class="p">:</span>
        <span class="k">assert</span> <span class="vm">__name__</span> <span class="o">==</span> <span class="n">pkg_name</span>
        <span class="n">calc</span> <span class="o">=</span> <span class="n">iprPy</span><span class="o">.</span><span class="n">load_calculation</span><span class="p">(</span><span class="n">calculation_style</span><span class="p">)</span>
        <span class="n">filedict</span> <span class="o">=</span> <span class="n">calc</span><span class="o">.</span><span class="n">filedict</span>
    <span class="k">except</span><span class="p">:</span>
        <span class="n">filedict</span> <span class="o">=</span> <span class="p">{}</span>

    <span class="c1"># Make system a deepcopy of itself (protect original from changes)</span>
    <span class="n">system</span> <span class="o">=</span> <span class="n">deepcopy</span><span class="p">(</span><span class="n">system</span><span class="p">)</span>

    <span class="c1"># Set ucell = system if ucell not given</span>
    <span class="k">if</span> <span class="n">ucell</span> <span class="ow">is</span> <span class="kc">None</span><span class="p">:</span>
        <span class="n">ucell</span> <span class="o">=</span> <span class="n">system</span>

    <span class="c1"># Calculate the r/a ratio for the unit cell</span>
    <span class="n">r_a</span> <span class="o">=</span> <span class="n">r_a_ratio</span><span class="p">(</span><span class="n">ucell</span><span class="p">)</span>

    <span class="c1"># Get ratios of lx, ly, and lz of system relative to a of ucell</span>
    <span class="n">lx_a</span> <span class="o">=</span> <span class="n">system</span><span class="o">.</span><span class="n">box</span><span class="o">.</span><span class="n">a</span> <span class="o">/</span> <span class="n">ucell</span><span class="o">.</span><span class="n">box</span><span class="o">.</span><span class="n">a</span>
    <span class="n">ly_a</span> <span class="o">=</span> <span class="n">system</span><span class="o">.</span><span class="n">box</span><span class="o">.</span><span class="n">b</span> <span class="o">/</span> <span class="n">ucell</span><span class="o">.</span><span class="n">box</span><span class="o">.</span><span class="n">a</span>
    <span class="n">lz_a</span> <span class="o">=</span> <span class="n">system</span><span class="o">.</span><span class="n">box</span><span class="o">.</span><span class="n">c</span> <span class="o">/</span> <span class="n">ucell</span><span class="o">.</span><span class="n">box</span><span class="o">.</span><span class="n">a</span>
    <span class="n">alpha</span> <span class="o">=</span> <span class="n">system</span><span class="o">.</span><span class="n">box</span><span class="o">.</span><span class="n">alpha</span>
    <span class="n">beta</span> <span class="o">=</span>  <span class="n">system</span><span class="o">.</span><span class="n">box</span><span class="o">.</span><span class="n">beta</span>
    <span class="n">gamma</span> <span class="o">=</span> <span class="n">system</span><span class="o">.</span><span class="n">box</span><span class="o">.</span><span class="n">gamma</span>

    <span class="c1"># Build lists of values</span>
    <span class="n">r_values</span> <span class="o">=</span> <span class="n">np</span><span class="o">.</span><span class="n">linspace</span><span class="p">(</span><span class="n">rmin</span><span class="p">,</span> <span class="n">rmax</span><span class="p">,</span> <span class="n">rsteps</span><span class="p">)</span>
    <span class="n">a_values</span> <span class="o">=</span> <span class="n">r_values</span> <span class="o">/</span> <span class="n">r_a</span>
    <span class="n">Ecoh_values</span> <span class="o">=</span> <span class="n">np</span><span class="o">.</span><span class="n">empty</span><span class="p">(</span><span class="n">rsteps</span><span class="p">)</span>

    <span class="c1"># Loop over values</span>
    <span class="k">for</span> <span class="n">i</span> <span class="ow">in</span> <span class="nb">range</span><span class="p">(</span><span class="n">rsteps</span><span class="p">):</span>

        <span class="c1"># Rescale system&#39;s box</span>
        <span class="n">a</span> <span class="o">=</span> <span class="n">a_values</span><span class="p">[</span><span class="n">i</span><span class="p">]</span>
        <span class="n">system</span><span class="o">.</span><span class="n">box_set</span><span class="p">(</span><span class="n">a</span> <span class="o">=</span> <span class="n">a</span> <span class="o">*</span> <span class="n">lx_a</span><span class="p">,</span>
                       <span class="n">b</span> <span class="o">=</span> <span class="n">a</span> <span class="o">*</span> <span class="n">ly_a</span><span class="p">,</span>
                       <span class="n">c</span> <span class="o">=</span> <span class="n">a</span> <span class="o">*</span> <span class="n">lz_a</span><span class="p">,</span>
                       <span class="n">alpha</span><span class="o">=</span><span class="n">alpha</span><span class="p">,</span> <span class="n">beta</span><span class="o">=</span><span class="n">beta</span><span class="p">,</span> <span class="n">gamma</span><span class="o">=</span><span class="n">gamma</span><span class="p">,</span> <span class="n">scale</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span>

        <span class="c1"># Get lammps units</span>
        <span class="n">lammps_units</span> <span class="o">=</span> <span class="n">lmp</span><span class="o">.</span><span class="n">style</span><span class="o">.</span><span class="n">unit</span><span class="p">(</span><span class="n">potential</span><span class="o">.</span><span class="n">units</span><span class="p">)</span>

        <span class="c1"># Define lammps variables</span>
        <span class="n">lammps_variables</span> <span class="o">=</span> <span class="p">{}</span>
        <span class="n">system_info</span> <span class="o">=</span> <span class="n">system</span><span class="o">.</span><span class="n">dump</span><span class="p">(</span><span class="s1">&#39;atom_data&#39;</span><span class="p">,</span> <span class="n">f</span><span class="o">=</span><span class="s1">&#39;atom.dat&#39;</span><span class="p">,</span>
                                  <span class="n">potential</span><span class="o">=</span><span class="n">potential</span><span class="p">,</span>
                                  <span class="n">return_pair_info</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span>
        <span class="n">lammps_variables</span><span class="p">[</span><span class="s1">&#39;atomman_system_pair_info&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="n">system_info</span>

        <span class="c1"># Write lammps input script</span>
        <span class="n">template_file</span> <span class="o">=</span> <span class="s1">&#39;run0.template&#39;</span>
        <span class="n">lammps_script</span> <span class="o">=</span> <span class="s1">&#39;run0.in&#39;</span>
        <span class="n">template</span> <span class="o">=</span> <span class="n">iprPy</span><span class="o">.</span><span class="n">tools</span><span class="o">.</span><span class="n">read_calc_file</span><span class="p">(</span><span class="n">template_file</span><span class="p">,</span> <span class="n">filedict</span><span class="p">)</span>
        <span class="k">with</span> <span class="nb">open</span><span class="p">(</span><span class="n">lammps_script</span><span class="p">,</span> <span class="s1">&#39;w&#39;</span><span class="p">)</span> <span class="k">as</span> <span class="n">f</span><span class="p">:</span>
            <span class="n">f</span><span class="o">.</span><span class="n">write</span><span class="p">(</span><span class="n">iprPy</span><span class="o">.</span><span class="n">tools</span><span class="o">.</span><span class="n">filltemplate</span><span class="p">(</span><span class="n">template</span><span class="p">,</span> <span class="n">lammps_variables</span><span class="p">,</span>
                                             <span class="s1">&#39;&lt;&#39;</span><span class="p">,</span> <span class="s1">&#39;&gt;&#39;</span><span class="p">))</span>

        <span class="c1"># Run lammps and extract data</span>
        <span class="k">try</span><span class="p">:</span>
            <span class="n">output</span> <span class="o">=</span> <span class="n">lmp</span><span class="o">.</span><span class="n">run</span><span class="p">(</span><span class="n">lammps_command</span><span class="p">,</span> <span class="n">lammps_script</span><span class="p">,</span> <span class="n">mpi_command</span><span class="p">)</span>
        <span class="k">except</span><span class="p">:</span>
            <span class="n">Ecoh_values</span><span class="p">[</span><span class="n">i</span><span class="p">]</span> <span class="o">=</span> <span class="n">np</span><span class="o">.</span><span class="n">nan</span>
        <span class="k">else</span><span class="p">:</span>
            <span class="n">thermo</span> <span class="o">=</span> <span class="n">output</span><span class="o">.</span><span class="n">simulations</span><span class="p">[</span><span class="mi">0</span><span class="p">][</span><span class="s1">&#39;thermo&#39;</span><span class="p">]</span>

            <span class="k">if</span> <span class="n">output</span><span class="o">.</span><span class="n">lammps_date</span> <span class="o">&lt;</span> <span class="n">datetime</span><span class="o">.</span><span class="n">date</span><span class="p">(</span><span class="mi">2016</span><span class="p">,</span> <span class="mi">8</span><span class="p">,</span> <span class="mi">1</span><span class="p">):</span>
                <span class="n">Ecoh_values</span><span class="p">[</span><span class="n">i</span><span class="p">]</span> <span class="o">=</span> <span class="n">uc</span><span class="o">.</span><span class="n">set_in_units</span><span class="p">(</span><span class="n">thermo</span><span class="o">.</span><span class="n">peatom</span><span class="o">.</span><span class="n">values</span><span class="p">[</span><span class="o">-</span><span class="mi">1</span><span class="p">],</span>
                                                <span class="n">lammps_units</span><span class="p">[</span><span class="s1">&#39;energy&#39;</span><span class="p">])</span>
            <span class="k">else</span><span class="p">:</span>
                <span class="n">Ecoh_values</span><span class="p">[</span><span class="n">i</span><span class="p">]</span> <span class="o">=</span> <span class="n">uc</span><span class="o">.</span><span class="n">set_in_units</span><span class="p">(</span><span class="n">thermo</span><span class="o">.</span><span class="n">v_peatom</span><span class="o">.</span><span class="n">values</span><span class="p">[</span><span class="o">-</span><span class="mi">1</span><span class="p">],</span>
                                                <span class="n">lammps_units</span><span class="p">[</span><span class="s1">&#39;energy&#39;</span><span class="p">])</span>

        <span class="c1"># Rename log.lammps</span>
        <span class="k">try</span><span class="p">:</span>
            <span class="n">shutil</span><span class="o">.</span><span class="n">move</span><span class="p">(</span><span class="s1">&#39;log.lammps&#39;</span><span class="p">,</span> <span class="s1">&#39;run0-&#39;</span><span class="o">+</span><span class="nb">str</span><span class="p">(</span><span class="n">i</span><span class="p">)</span><span class="o">+</span><span class="s1">&#39;-log.lammps&#39;</span><span class="p">)</span>
        <span class="k">except</span><span class="p">:</span>
            <span class="k">pass</span>

    <span class="k">if</span> <span class="nb">len</span><span class="p">(</span><span class="n">Ecoh_values</span><span class="p">[</span><span class="n">np</span><span class="o">.</span><span class="n">isfinite</span><span class="p">(</span><span class="n">Ecoh_values</span><span class="p">)])</span> <span class="o">==</span> <span class="mi">0</span><span class="p">:</span>
        <span class="k">raise</span> <span class="ne">ValueError</span><span class="p">(</span><span class="s1">&#39;All LAMMPS runs failed. Potential likely invalid or incompatible.&#39;</span><span class="p">)</span>

    <span class="c1"># Find unit cell systems at the energy minimums</span>
    <span class="n">min_cells</span> <span class="o">=</span> <span class="p">[]</span>
    <span class="k">for</span> <span class="n">i</span> <span class="ow">in</span> <span class="nb">range</span><span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="n">rsteps</span> <span class="o">-</span> <span class="mi">1</span><span class="p">):</span>
        <span class="k">if</span> <span class="p">(</span><span class="n">Ecoh_values</span><span class="p">[</span><span class="n">i</span><span class="p">]</span> <span class="o">&lt;</span> <span class="n">Ecoh_values</span><span class="p">[</span><span class="n">i</span><span class="o">-</span><span class="mi">1</span><span class="p">]</span>
            <span class="ow">and</span> <span class="n">Ecoh_values</span><span class="p">[</span><span class="n">i</span><span class="p">]</span> <span class="o">&lt;</span> <span class="n">Ecoh_values</span><span class="p">[</span><span class="n">i</span><span class="o">+</span><span class="mi">1</span><span class="p">]):</span>
            <span class="n">a</span> <span class="o">=</span> <span class="n">a_values</span><span class="p">[</span><span class="n">i</span><span class="p">]</span>
            <span class="n">cell</span> <span class="o">=</span> <span class="n">deepcopy</span><span class="p">(</span><span class="n">ucell</span><span class="p">)</span>
            <span class="n">cell</span><span class="o">.</span><span class="n">box_set</span><span class="p">(</span><span class="n">a</span> <span class="o">=</span> <span class="n">a</span><span class="p">,</span>
                         <span class="n">b</span> <span class="o">=</span> <span class="n">a</span> <span class="o">*</span> <span class="n">ucell</span><span class="o">.</span><span class="n">box</span><span class="o">.</span><span class="n">b</span> <span class="o">/</span> <span class="n">ucell</span><span class="o">.</span><span class="n">box</span><span class="o">.</span><span class="n">a</span><span class="p">,</span>
                         <span class="n">c</span> <span class="o">=</span> <span class="n">a</span> <span class="o">*</span> <span class="n">ucell</span><span class="o">.</span><span class="n">box</span><span class="o">.</span><span class="n">c</span> <span class="o">/</span> <span class="n">ucell</span><span class="o">.</span><span class="n">box</span><span class="o">.</span><span class="n">a</span><span class="p">,</span>
                         <span class="n">alpha</span><span class="o">=</span><span class="n">alpha</span><span class="p">,</span> <span class="n">beta</span><span class="o">=</span><span class="n">beta</span><span class="p">,</span> <span class="n">gamma</span><span class="o">=</span><span class="n">gamma</span><span class="p">,</span> <span class="n">scale</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span>
            <span class="n">min_cells</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">cell</span><span class="p">)</span>

    <span class="c1"># Collect results</span>
    <span class="n">results_dict</span> <span class="o">=</span> <span class="p">{}</span>
    <span class="n">results_dict</span><span class="p">[</span><span class="s1">&#39;r_values&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="n">r_values</span>
    <span class="n">results_dict</span><span class="p">[</span><span class="s1">&#39;a_values&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="n">a_values</span>
    <span class="n">results_dict</span><span class="p">[</span><span class="s1">&#39;Ecoh_values&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="n">Ecoh_values</span>
    <span class="n">results_dict</span><span class="p">[</span><span class="s1">&#39;min_cell&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="n">min_cells</span>

    <span class="k">return</span> <span class="n">results_dict</span>
</pre></div>
</div>
</div>
</div>
<div class="section" id="3.3.-r_a_ratio()">
<h4>3.3. r_a_ratio()<a class="headerlink" href="#3.3.-r_a_ratio()" title="Permalink to this headline">¶</a></h4>
<div class="nbinput nblast docutils container">
<div class="prompt highlight-none notranslate"><div class="highlight"><pre><span></span>[11]:
</pre></div>
</div>
<div class="input_area highlight-ipython3 notranslate"><div class="highlight"><pre>
<span></span><span class="k">def</span> <span class="nf">r_a_ratio</span><span class="p">(</span><span class="n">ucell</span><span class="p">):</span>
    <span class="sd">&quot;&quot;&quot;</span>
<span class="sd">    Calculates the r/a ratio by identifying the shortest interatomic spacing, r,</span>
<span class="sd">    for a unit cell.</span>

<span class="sd">    Parameters</span>
<span class="sd">    ----------</span>
<span class="sd">    ucell : atomman.System</span>
<span class="sd">        The unit cell system to evaluate.</span>

<span class="sd">    Returns</span>
<span class="sd">    -------</span>
<span class="sd">    float</span>
<span class="sd">        The shortest interatomic spacing, r, divided by the unit cell&#39;s a</span>
<span class="sd">        lattice parameter.</span>
<span class="sd">    &quot;&quot;&quot;</span>
    <span class="n">r_a</span> <span class="o">=</span> <span class="n">ucell</span><span class="o">.</span><span class="n">box</span><span class="o">.</span><span class="n">a</span>
    <span class="k">for</span> <span class="n">i</span> <span class="ow">in</span> <span class="nb">range</span><span class="p">(</span><span class="n">ucell</span><span class="o">.</span><span class="n">natoms</span><span class="p">):</span>
        <span class="k">for</span> <span class="n">j</span> <span class="ow">in</span> <span class="nb">range</span><span class="p">(</span><span class="n">i</span><span class="p">):</span>
            <span class="n">dmag</span> <span class="o">=</span> <span class="n">np</span><span class="o">.</span><span class="n">linalg</span><span class="o">.</span><span class="n">norm</span><span class="p">(</span><span class="n">ucell</span><span class="o">.</span><span class="n">dvect</span><span class="p">(</span><span class="n">i</span><span class="p">,</span><span class="n">j</span><span class="p">))</span>
            <span class="k">if</span> <span class="n">dmag</span> <span class="o">&lt;</span> <span class="n">r_a</span><span class="p">:</span>
                <span class="n">r_a</span> <span class="o">=</span> <span class="n">dmag</span>
    <span class="k">return</span> <span class="n">r_a</span> <span class="o">/</span> <span class="n">ucell</span><span class="o">.</span><span class="n">box</span><span class="o">.</span><span class="n">a</span>
</pre></div>
</div>
</div>
</div>
</div>
<div class="section" id="4.-Run-calculation-function(s)">
<h3>4. Run calculation function(s)<a class="headerlink" href="#4.-Run-calculation-function(s)" title="Permalink to this headline">¶</a></h3>
<div class="nbinput nblast docutils container">
<div class="prompt highlight-none notranslate"><div class="highlight"><pre><span></span>[12]:
</pre></div>
</div>
<div class="input_area highlight-ipython3 notranslate"><div class="highlight"><pre>
<span></span><span class="n">results_dict</span> <span class="o">=</span> <span class="n">e_vs_r</span><span class="p">(</span><span class="n">lammps_command</span><span class="p">,</span> <span class="n">system</span><span class="p">,</span> <span class="n">potential</span><span class="p">,</span>
                      <span class="n">mpi_command</span> <span class="o">=</span> <span class="n">mpi_command</span><span class="p">,</span>
                      <span class="n">ucell</span> <span class="o">=</span> <span class="n">ucell</span><span class="p">,</span>
                      <span class="n">rmin</span> <span class="o">=</span> <span class="n">rmin</span><span class="p">,</span>
                      <span class="n">rmax</span> <span class="o">=</span> <span class="n">rmax</span><span class="p">,</span>
                      <span class="n">rsteps</span> <span class="o">=</span> <span class="n">rsteps</span><span class="p">)</span>
</pre></div>
</div>
</div>
<div class="nbinput docutils container">
<div class="prompt highlight-none notranslate"><div class="highlight"><pre><span></span>[13]:
</pre></div>
</div>
<div class="input_area highlight-ipython3 notranslate"><div class="highlight"><pre>
<span></span><span class="n">results_dict</span><span class="o">.</span><span class="n">keys</span><span class="p">()</span>
</pre></div>
</div>
</div>
<div class="nboutput nblast docutils container">
<div class="prompt highlight-none notranslate"><div class="highlight"><pre><span></span>[13]:
</pre></div>
</div>
<div class="output_area docutils container">
<div class="highlight"><pre>
dict_keys([&#39;r_values&#39;, &#39;a_values&#39;, &#39;Ecoh_values&#39;, &#39;min_cell&#39;])
</pre></div></div>
</div>
</div>
<div class="section" id="5.-Report-results">
<h3>5. Report results<a class="headerlink" href="#5.-Report-results" title="Permalink to this headline">¶</a></h3>
<div class="section" id="5.1.-Define-units-for-outputting-values">
<h4>5.1. Define units for outputting values<a class="headerlink" href="#5.1.-Define-units-for-outputting-values" title="Permalink to this headline">¶</a></h4>
<ul class="simple">
<li><p><strong>length_unit</strong> is the unit of length to display values in.</p></li>
<li><p><strong>energy_unit</strong> is the unit of energy to display values in.</p></li>
</ul>
<div class="nbinput nblast docutils container">
<div class="prompt highlight-none notranslate"><div class="highlight"><pre><span></span>[14]:
</pre></div>
</div>
<div class="input_area highlight-ipython3 notranslate"><div class="highlight"><pre>
<span></span><span class="n">length_unit</span> <span class="o">=</span> <span class="s1">&#39;angstrom&#39;</span>
<span class="n">energy_unit</span> <span class="o">=</span> <span class="s1">&#39;eV&#39;</span>
</pre></div>
</div>
</div>
</div>
<div class="section" id="5.2.-Plot-Ecoh-vs-r">
<h4>5.2. Plot Ecoh vs r<a class="headerlink" href="#5.2.-Plot-Ecoh-vs-r" title="Permalink to this headline">¶</a></h4>
<div class="nbinput docutils container">
<div class="prompt highlight-none notranslate"><div class="highlight"><pre><span></span>[15]:
</pre></div>
</div>
<div class="input_area highlight-ipython3 notranslate"><div class="highlight"><pre>
<span></span><span class="n">Ecoh</span> <span class="o">=</span> <span class="n">uc</span><span class="o">.</span><span class="n">get_in_units</span><span class="p">(</span><span class="n">results_dict</span><span class="p">[</span><span class="s1">&#39;Ecoh_values&#39;</span><span class="p">],</span> <span class="n">energy_unit</span><span class="p">)</span>
<span class="n">r</span> <span class="o">=</span> <span class="n">uc</span><span class="o">.</span><span class="n">get_in_units</span><span class="p">(</span><span class="n">results_dict</span><span class="p">[</span><span class="s1">&#39;r_values&#39;</span><span class="p">],</span> <span class="n">length_unit</span><span class="p">)</span>

<span class="n">Emin</span> <span class="o">=</span> <span class="n">floor</span><span class="p">(</span><span class="n">Ecoh</span><span class="o">.</span><span class="n">min</span><span class="p">())</span>
<span class="k">if</span> <span class="n">Emin</span> <span class="o">&lt;</span> <span class="o">-</span><span class="mi">10</span><span class="p">:</span>
    <span class="n">Emin</span> <span class="o">=</span> <span class="o">-</span><span class="mi">10</span>

<span class="n">plot</span> <span class="o">=</span> <span class="n">figure</span><span class="p">(</span><span class="n">title</span> <span class="o">=</span> <span class="n">f</span><span class="s1">&#39;Cohesive Energy vs. Interatomic Spacing&#39;</span><span class="p">,</span>
              <span class="n">plot_width</span> <span class="o">=</span> <span class="mi">800</span><span class="p">,</span>
              <span class="n">plot_height</span> <span class="o">=</span> <span class="mi">600</span><span class="p">,</span>
              <span class="n">x_range</span> <span class="o">=</span> <span class="p">[</span><span class="n">uc</span><span class="o">.</span><span class="n">get_in_units</span><span class="p">(</span><span class="n">rmin</span><span class="p">,</span> <span class="s1">&#39;angstrom&#39;</span><span class="p">),</span> <span class="n">uc</span><span class="o">.</span><span class="n">get_in_units</span><span class="p">(</span><span class="n">rmax</span><span class="p">,</span> <span class="s1">&#39;angstrom&#39;</span><span class="p">)],</span>
              <span class="n">y_range</span> <span class="o">=</span> <span class="p">[</span><span class="n">Emin</span><span class="p">,</span> <span class="mi">0</span><span class="p">],</span>
              <span class="n">x_axis_label</span><span class="o">=</span><span class="n">f</span><span class="s1">&#39;r (</span><span class="si">{length_unit}</span><span class="s1">)&#39;</span><span class="p">,</span>
              <span class="n">y_axis_label</span><span class="o">=</span><span class="n">f</span><span class="s1">&#39;Cohesive Energy (</span><span class="si">{energy_unit}</span><span class="s1">/atom)&#39;</span><span class="p">)</span>

<span class="n">plot</span><span class="o">.</span><span class="n">line</span><span class="p">(</span><span class="n">r</span><span class="p">,</span> <span class="n">Ecoh</span><span class="p">,</span> <span class="n">line_width</span> <span class="o">=</span> <span class="mi">2</span><span class="p">)</span>

<span class="n">show</span><span class="p">(</span><span class="n">plot</span><span class="p">)</span>
</pre></div>
</div>
</div>
<div class="nboutput docutils container">
<div class="prompt empty docutils container">
</div>
<div class="output_area rendered_html docutils container">
<div class="bk-root" id="f00afec5-9cb9-4157-a53f-354e40d88834" data-root-id="1002"></div></div>
</div>
<div class="nboutput nblast docutils container">
<div class="prompt empty docutils container">
</div>
<div class="output_area docutils container">
<div class="output_javascript"></div>
<script type="text/javascript">
var element = document.currentScript.previousSibling.previousSibling;
(function(root) {
  function embed_document(root) {

  var docs_json = {"9860bcf6-0ea8-4c96-83b6-c98f924be54e":{"roots":{"references":[{"attributes":{"below":[{"id":"1013","type":"LinearAxis"}],"center":[{"id":"1017","type":"Grid"},{"id":"1022","type":"Grid"}],"left":[{"id":"1018","type":"LinearAxis"}],"plot_width":800,"renderers":[{"id":"1039","type":"GlyphRenderer"}],"title":{"id":"1003","type":"Title"},"toolbar":{"id":"1029","type":"Toolbar"},"x_range":{"id":"1005","type":"Range1d"},"x_scale":{"id":"1009","type":"LinearScale"},"y_range":{"id":"1007","type":"Range1d"},"y_scale":{"id":"1011","type":"LinearScale"}},"id":"1002","subtype":"Figure","type":"Plot"},{"attributes":{"text":"Cohesive Energy vs. Interatomic Spacing"},"id":"1003","type":"Title"},{"attributes":{"line_alpha":0.1,"line_color":"#1f77b4","line_width":2,"x":{"field":"x"},"y":{"field":"y"}},"id":"1038","type":"Line"},{"attributes":{"data_source":{"id":"1036","type":"ColumnDataSource"},"glyph":{"id":"1037","type":"Line"},"hover_glyph":null,"muted_glyph":null,"nonselection_glyph":{"id":"1038","type":"Line"},"selection_glyph":null,"view":{"id":"1040","type":"CDSView"}},"id":"1039","type":"GlyphRenderer"},{"attributes":{"dimension":1,"ticker":{"id":"1019","type":"BasicTicker"}},"id":"1022","type":"Grid"},{"attributes":{},"id":"1045","type":"BasicTickFormatter"},{"attributes":{"callback":null,"end":6.0,"start":2.0},"id":"1005","type":"Range1d"},{"attributes":{"source":{"id":"1036","type":"ColumnDataSource"}},"id":"1040","type":"CDSView"},{"attributes":{},"id":"1047","type":"UnionRenderers"},{"attributes":{"axis_label":"r (angstrom)","formatter":{"id":"1045","type":"BasicTickFormatter"},"ticker":{"id":"1014","type":"BasicTicker"}},"id":"1013","type":"LinearAxis"},{"attributes":{"active_drag":"auto","active_inspect":"auto","active_multi":null,"active_scroll":"auto","active_tap":"auto","tools":[{"id":"1023","type":"PanTool"},{"id":"1024","type":"WheelZoomTool"},{"id":"1025","type":"BoxZoomTool"},{"id":"1026","type":"SaveTool"},{"id":"1027","type":"ResetTool"},{"id":"1028","type":"HelpTool"}]},"id":"1029","type":"Toolbar"},{"attributes":{},"id":"1011","type":"LinearScale"},{"attributes":{},"id":"1043","type":"BasicTickFormatter"},{"attributes":{"callback":null,"data":{"x":{"__ndarray__":"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","dtype":"float64","shape":[200]},"y":{"__ndarray__":"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","dtype":"float64","shape":[200]}},"selected":{"id":"1046","type":"Selection"},"selection_policy":{"id":"1047","type":"UnionRenderers"}},"id":"1036","type":"ColumnDataSource"},{"attributes":{},"id":"1024","type":"WheelZoomTool"},{"attributes":{},"id":"1027","type":"ResetTool"},{"attributes":{"axis_label":"Cohesive Energy (eV/atom)","formatter":{"id":"1043","type":"BasicTickFormatter"},"ticker":{"id":"1019","type":"BasicTicker"}},"id":"1018","type":"LinearAxis"},{"attributes":{},"id":"1009","type":"LinearScale"},{"attributes":{"line_color":"#1f77b4","line_width":2,"x":{"field":"x"},"y":{"field":"y"}},"id":"1037","type":"Line"},{"attributes":{"ticker":{"id":"1014","type":"BasicTicker"}},"id":"1017","type":"Grid"},{"attributes":{},"id":"1026","type":"SaveTool"},{"attributes":{},"id":"1023","type":"PanTool"},{"attributes":{},"id":"1014","type":"BasicTicker"},{"attributes":{"overlay":{"id":"1048","type":"BoxAnnotation"}},"id":"1025","type":"BoxZoomTool"},{"attributes":{"callback":null,"end":0,"start":-5},"id":"1007","type":"Range1d"},{"attributes":{},"id":"1019","type":"BasicTicker"},{"attributes":{},"id":"1028","type":"HelpTool"},{"attributes":{},"id":"1046","type":"Selection"},{"attributes":{"bottom_units":"screen","fill_alpha":{"value":0.5},"fill_color":{"value":"lightgrey"},"left_units":"screen","level":"overlay","line_alpha":{"value":1.0},"line_color":{"value":"black"},"line_dash":[4,4],"line_width":{"value":2},"render_mode":"css","right_units":"screen","top_units":"screen"},"id":"1048","type":"BoxAnnotation"}],"root_ids":["1002"]},"title":"Bokeh Application","version":"1.3.4"}};
  var render_items = [{"docid":"9860bcf6-0ea8-4c96-83b6-c98f924be54e","roots":{"1002":"f00afec5-9cb9-4157-a53f-354e40d88834"}}];
  root.Bokeh.embed.embed_items_notebook(docs_json, render_items);

  }
  if (root.Bokeh !== undefined) {
    embed_document(root);
  } else {
    var attempts = 0;
    var timer = setInterval(function(root) {
      if (root.Bokeh !== undefined) {
        embed_document(root);
        clearInterval(timer);
      }
      attempts++;
      if (attempts > 100) {
        console.log("Bokeh: ERROR: Unable to run BokehJS code because BokehJS library is missing");
        clearInterval(timer);
      }
    }, 10, root)
  }
})(window);
</script></div>
</div>
</div>
<div class="section" id="5.3.-List-minimum-energy-configurations">
<h4>5.3. List minimum energy configurations<a class="headerlink" href="#5.3.-List-minimum-energy-configurations" title="Permalink to this headline">¶</a></h4>
<div class="nbinput docutils container">
<div class="prompt highlight-none notranslate"><div class="highlight"><pre><span></span>[16]:
</pre></div>
</div>
<div class="input_area highlight-ipython3 notranslate"><div class="highlight"><pre>
<span></span><span class="k">for</span> <span class="n">mincell</span> <span class="ow">in</span> <span class="n">results_dict</span><span class="p">[</span><span class="s1">&#39;min_cell&#39;</span><span class="p">]:</span>
    <span class="nb">print</span><span class="p">(</span><span class="s1">&#39;Possible minimum near:&#39;</span><span class="p">)</span>
    <span class="nb">print</span><span class="p">(</span><span class="s1">&#39;a =&#39;</span><span class="p">,</span> <span class="n">uc</span><span class="o">.</span><span class="n">get_in_units</span><span class="p">(</span><span class="n">mincell</span><span class="o">.</span><span class="n">box</span><span class="o">.</span><span class="n">a</span><span class="p">,</span> <span class="n">length_unit</span><span class="p">),</span> <span class="n">length_unit</span><span class="p">)</span>
    <span class="nb">print</span><span class="p">(</span><span class="s1">&#39;b =&#39;</span><span class="p">,</span> <span class="n">uc</span><span class="o">.</span><span class="n">get_in_units</span><span class="p">(</span><span class="n">mincell</span><span class="o">.</span><span class="n">box</span><span class="o">.</span><span class="n">b</span><span class="p">,</span> <span class="n">length_unit</span><span class="p">),</span> <span class="n">length_unit</span><span class="p">)</span>
    <span class="nb">print</span><span class="p">(</span><span class="s1">&#39;c =&#39;</span><span class="p">,</span> <span class="n">uc</span><span class="o">.</span><span class="n">get_in_units</span><span class="p">(</span><span class="n">mincell</span><span class="o">.</span><span class="n">box</span><span class="o">.</span><span class="n">c</span><span class="p">,</span> <span class="n">length_unit</span><span class="p">),</span> <span class="n">length_unit</span><span class="p">)</span>
    <span class="nb">print</span><span class="p">()</span>
</pre></div>
</div>
</div>
<div class="nboutput nblast docutils container">
<div class="prompt empty docutils container">
</div>
<div class="output_area docutils container">
<div class="highlight"><pre>
Possible minimum near:
a = 3.510660803076929 angstrom
b = 3.510660803076929 angstrom
c = 3.510660803076929 angstrom

Possible minimum near:
a = 7.376651646951118 angstrom
b = 7.376651646951118 angstrom
c = 7.376651646951118 angstrom

</pre></div></div>
</div>
</div>
</div>
</div>
</div>


          </div>
        </div>
      </div>
      <div class="sphinxsidebar" role="navigation" aria-label="main navigation">
        <div class="sphinxsidebarwrapper">
  <h3><a href="../index.html">Table of Contents</a></h3>
  <ul>
<li><a class="reference internal" href="#">E_vs_r_scan calculation style</a><ul>
<li><a class="reference internal" href="#Introduction">Introduction</a><ul>
<li><a class="reference internal" href="#Version-notes">Version notes</a></li>
<li><a class="reference internal" href="#Additional-dependencies">Additional dependencies</a></li>
<li><a class="reference internal" href="#Disclaimers">Disclaimers</a></li>
</ul>
</li>
<li><a class="reference internal" href="#Method-and-Theory">Method and Theory</a></li>
<li><a class="reference internal" href="#Demonstration">Demonstration</a><ul>
<li><a class="reference internal" href="#1.-Setup">1. Setup</a><ul>
<li><a class="reference internal" href="#1.1.-Library-imports">1.1. Library imports</a></li>
<li><a class="reference internal" href="#1.2.-Default-calculation-setup">1.2. Default calculation setup</a></li>
</ul>
</li>
<li><a class="reference internal" href="#2.-Assign-values-for-the-calculation’s-run-parameters">2. Assign values for the calculation’s run parameters</a><ul>
<li><a class="reference internal" href="#2.1.-Specify-system-specific-paths">2.1. Specify system-specific paths</a></li>
<li><a class="reference internal" href="#2.2.-Load-interatomic-potential">2.2. Load interatomic potential</a></li>
<li><a class="reference internal" href="#2.3.-Load-initial-unit-cell-system">2.3. Load initial unit cell system</a></li>
<li><a class="reference internal" href="#2.4.-Modify-system">2.4. Modify system</a></li>
<li><a class="reference internal" href="#2.5.-Specify-calculation-specific-run-parameters">2.5. Specify calculation-specific run parameters</a></li>
</ul>
</li>
<li><a class="reference internal" href="#3.-Define-calculation-function(s)-and-generate-template-LAMMPS-script(s)">3. Define calculation function(s) and generate template LAMMPS script(s)</a><ul>
<li><a class="reference internal" href="#3.1.-run0.template">3.1. run0.template</a></li>
<li><a class="reference internal" href="#3.2.-e_vs_r()">3.2. e_vs_r()</a></li>
<li><a class="reference internal" href="#3.3.-r_a_ratio()">3.3. r_a_ratio()</a></li>
</ul>
</li>
<li><a class="reference internal" href="#4.-Run-calculation-function(s)">4. Run calculation function(s)</a></li>
<li><a class="reference internal" href="#5.-Report-results">5. Report results</a><ul>
<li><a class="reference internal" href="#5.1.-Define-units-for-outputting-values">5.1. Define units for outputting values</a></li>
<li><a class="reference internal" href="#5.2.-Plot-Ecoh-vs-r">5.2. Plot Ecoh vs r</a></li>
<li><a class="reference internal" href="#5.3.-List-minimum-energy-configurations">5.3. List minimum energy configurations</a></li>
</ul>
</li>
</ul>
</li>
</ul>
</li>
</ul>

  <h4>Previous topic</h4>
  <p class="topless"><a href="../notebook_styles.html"
                        title="previous chapter">Jupyter Demonstration Notebooks</a></p>
  <h4>Next topic</h4>
  <p class="topless"><a href="crystal_space_group.html"
                        title="next chapter">crystal_space_group calculation style</a></p>
        </div>
      </div>
      <div class="clearer"></div>
    </div>
    <div class="related" role="navigation" aria-label="related navigation">
      <h3>Navigation</h3>
      <ul>
        <li class="right" style="margin-right: 10px">
          <a href="../genindex.html" title="General Index"
             >index</a></li>
        <li class="right" >
          <a href="../py-modindex.html" title="Python Module Index"
             >modules</a> |</li>
        <li class="right" >
          <a href="crystal_space_group.html" title="crystal_space_group calculation style"
             >next</a> |</li>
        <li class="right" >
          <a href="../notebook_styles.html" title="Jupyter Demonstration Notebooks"
             >previous</a> |</li>
        <li class="nav-item nav-item-0"><a href="../index.html">iprPy 0.10.2 documentation</a> &#187;</li>
          <li class="nav-item nav-item-1"><a href="../notebook_styles.html" >Jupyter Demonstration Notebooks</a> &#187;</li> 
      </ul>
    </div>
    <div class="footer" role="contentinfo">
      Created using <a href="http://sphinx-doc.org/">Sphinx</a> 2.1.2.
    </div>
  </body>
</html>